package com.xxx.store.controller;


import com.xxx.store.entity.Atemplate;
import com.xxx.store.entity.Notice;
import com.xxx.store.service.AtemplateService;
import com.xxx.store.service.NoticeService;
import com.xxx.store.utils.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2023-04-07
 */
@RestController
@RequestMapping("/notice")
public class NoticeController extends BaseController<Notice, NoticeService>{
    @Resource
    NoticeService noticeService;

    @PostMapping("/add")
    public Result add(@RequestBody Notice notice){
        Date date = new Date();
        notice.setCreateTime(date);
        noticeService.save(notice);
        return Result.ok("添加成功", notice);
    }
}

